package gui;

public class ShortcutFactory {
	public enum FactoryType { EDITOR, PLAIN, FILE_EDITOR }
	
	private FactoryType type;
	private ShortcutFactory (FactoryType type){
		this.type = type;
	}
	public Shortcut createShortcut(String id, String execPath, String displayTitle, String group){
		switch (type) {
		case EDITOR:
			return createShortcutButtonEditor(id, execPath, displayTitle, group);
			
		case PLAIN:
			return createShortcutButton(id, execPath, displayTitle, group);
		case FILE_EDITOR:
			return createShortcutButtonEditorFile(id, execPath, displayTitle, group);
		default:
			return null;
		}
	}
	private Shortcut createShortcutButtonEditorFile(String id, String execPath,
			String displayTitle, String group) {
		ShortcutButtonFileEditor button = new ShortcutButtonFileEditor();
		button.setup(id, execPath, displayTitle, group);
		return button;
	}
	private Shortcut createShortcutButton(String id, String execPath, String displayTitle, String group){
		ShortcutButton button = new ShortcutButton();
		button.setup(id, execPath, displayTitle, group);
		return button;
	}
	private Shortcut createShortcutButtonEditor(String id, String execPath, String displayTitle, String group){
		ShortcutButtonEditor button = new ShortcutButtonEditor();
		button.setup(id, execPath, displayTitle, group);
		return button;
	}
	public static ShortcutFactory getFactory (FactoryType type){
		return new ShortcutFactory(type);
	}
}
